from urllib.parse import urlsplit
from urllib.parse import urljoin

def get_hostname(url):
    base_url = "{0.scheme}://{0.netloc}/".format(urlsplit(url))
    return base_url

def join_path_to_hostname(base_url, path):
    return urljoin(base_url, path)